<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>${appname}-<c:if test="${!empty sessionScope._local_node_session}">${sessionScope._local_node_session.nodeName}-</c:if>${si:ctname("NET_TYPE",sessionScope._netType)}</title>
<%@ include file="/WEB-INF/view/common/css_js_base.jsp"%>
<script type="text/javascript">
$(function(){
	//$('#inputForm input').tooltip({'placement':'top'});
	$('#inputForm input').tooltip();
	//表单验证
	$('#inputForm').checkForm();
	
    $('#inputForm').ajaxForm({ 
        url: _ctx + "/registry/node_add.do", 
        type: "POST",
        dataType:"json",
        beforeSubmit: function(){
           	$("#sbmBtn").attr("disabled","disabled");
        },
        clearForm: false,
        resetForm: false,
        success: function(resp){
        	if(resp.status == '1' ){
        		ui.msg(resp.msg, 1);
        		ui.go(_ctx + '/registry/node_list.do');
        	}else{
        		ui.msg(resp.msg, 0);
        	}
        	$("#sbmBtn").removeClass("disabled").attr("disabled",null);
        },
        error:function(resp){
        	ui.msg('请求发送失败', 0);
    		$("#sbmBtn").removeClass("disabled").attr("disabled",null);
        }
    });
});

</script>
</head>
<body>
<%@ include file="/WEB-INF/view/common/navbar.jsp"%>
<div class="container">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				  <div class="panel-heading">
				        服务注册
				    <div class="pull-right">
						<a class="btn btn-primary btn-xs" href="${ctx}/registry/service_list.do"><i class="glyphicon glyphicon-arrow-left"></i> 返回</a>
					</div>
				  </div>
				  <div class="panel-body">
					<form class="form-horizontal" role="form" id="inputForm" action="" method="post">
					  <div class="form-group">
					    <label class="col-sm-2 control-label">节点编码 *</label>
					    <div class="col-sm-6">
					      <input type="text" class="form-control" 
					      	value=""  name="code" id="code"  datatype="require|ajax"
					      	url="${ctx}/registry/check_code.do" 
							msg="请输入节点编码|节点编码已经存在" title="必填项，节点编码"/>
					    </div>
					  </div>
					  <div class="form-group">
					    <label class="col-sm-2 control-label">服务名称 *</label>
					    <div class="col-sm-6">
					    	<input type="text" class="form-control" 
					      	value=""  name="name" id="name"  datatype="require" 
							msg="请输入节点名称" title="必填项,节点名称"/>
					    </div>
					  </div>
					  <div class="form-group">
					    <label class="col-sm-2 control-label">服务地址 *</label>
					    <div class="col-sm-6">
					    	<input type="text" class="form-control" 
					      	value=""  name="name" id="name"  datatype="require" 
							msg="请输入节点名称" title="必填项,节点名称"/>
					    </div>
					  </div>
					  <div class="form-group">
					    <label class="col-sm-2 control-label">备注</label>
					    <div class="col-sm-6">
					      <input type="text" class="form-control" name="note" id="note" title="备注"/>
					    </div>
					  </div>
					  <div class="form-group">
					    <div class="col-sm-offset-2 col-sm-6">
					      <button type="submit" class="btn btn-primary btn-sm" id="sbmBtn"><i class="glyphicon glyphicon-saved"></i> 提交</button>
					    </div>
					  </div>
					</form>
				  </div>
			</div>
		</div>
	</div>
</div>
<%@ include file="/WEB-INF/view/common/footer.jsp"%>
</body>
</html>
